<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ page contentType="text/html; charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>产品管理</title>
    <meta charset="UTF-8">
    <base href="${basePath}">
    <jsp:include page="../common.jsp"></jsp:include>
</head>
<body>

<form id="playerform" class="form-inline definewidth m20" action="/" method="post">
    <label><span>玩家ID：</span><input type="text" name="id" id="id" class="abc input-default"
                                    value="${playerId}">&nbsp;&nbsp;
    </label>
    <button type="button" class="btn btn-primary" onclick="queryPlayer();">查询</button>
</form>

<div  style="float: right; font-size: larger;margin-right: 40px;font-weight: bold">
    <span>注册人数：</span> <font id="allCount" size="6" color="#FF0000" > ${allCount}</font>
    <span>在线人数：</span><font id="onlineCount" size="6" color="#FF0000">${onlineCount}</font>
</div>
<table id="products">

</table>
</body>
<script type="text/javascript">
$(function(){
	initTable();	
	
});

function initTable(){
	var queryParams=function (params) {
		console.log(params);
        var temp = {   //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
                limit: params.limit,   //页面大小
                offset: params.offset||1,  //页码
            };
            return temp;
        };
	$('#infoTable').bootstrapTable({
		url: sys.context+'club/getManagerTable.html',
		method: 'post',
		cache: false,
		pagination: true,
		queryParams: queryParams,
		sidePagination: "server",
		pageNumber:1,
		pageSize: 10,                       //每页的记录行数（*）
        pageList: [10, 25, 50, 100],
	    columns: [{field: 'id',title: '序号',align: 'center'},
	              {field: 'adminDesc',title: '名称',align: 'center'},
	              {field: 'userName',title: '数量',width: '8%',align: 'center'},
	              {field: 'userAccount', title: '金额',align: 'center'}, 
	              {field: 'playerId',title: '单价',align: 'center'}, 
	              {field: 'createTime',title: '一级代理',align: 'center'},
	              {field: 'parentManager',title: '二级代理',align: 'center'},
	              {field: 'agentCoin',title: '是否限时',align: 'center'},
	              {field: 'userType',title: '限时类型',align: 'center',
						formatter:function(v,r,i){
	        				return v==0?"二级代理":"<kbd>一级代理</kbd>";
	        	  		}
	              },
	              {field: 'todaySale',title: '限时时间',align: 'center'},
	              {field: '_opt',title:'操作',align: 'center',
	            	  formatter:function(v,r,i){
	            		  return '<a href="#" onclick="insertRow('+r['id']+',this)" class="btn btn-primary">加钻</a>'+
	            		  '<div class="btn-group">'+
	    				  '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">其他 <span class="caret"></span></button>'+
	    				  '<ul class="dropdown-menu">'+
	    				  		+'<li><a href="#" class="btn btn-success " onclick="changePwd('+r['id']+','+r['userAccount']+')">重置密码</a></li>'
	    				  		+'<li role="separator" class="divider"></li>'
	    				    	+'<li><a href="#" class="btn btn-success" onclick="deleteManager('+r['id']+','+r['userAccount']+')">删除</a></li>'
	    				    	+'<li><a href="#" class="btn btn-success" onclick="upOrDownLevel('+r['id']+')">'+(r['userType']==0?'升级':'降级')+'</a></li>'
	    				    	+'<li><a href="#" class="btn btn-success" onclick="updateAdminDesc('+r['adminDesc']+','+r['id']+')">备注</a></li>'
	    				    	+'<li><a href="#" class="btn btn-success" data-backdrop="static" data-toggle="modal" data-target="#addClubModal" data-managerId="'+r['id']+'"  data-managerName="'+r['userName']+'" >添加俱乐部</a></li>'
	    				  +'</ul>'
	    				+'</div>';
	            	  }
	              }
	    ],
	    data: [{
	    	userAccount: "-",
	    	userName: '-',
	    	playerId: '-',
	    	agentCoin: '-'
	    }]
	});
	
}
function insertRow(){
	$('#infoTable').bootstrapTable('insertRow', {id: 3, row: row});
}
</script>
</html>